// Copyright 2008. Liberal Lab Incorporated. All Rights Reserved.
/**
@author LION
 */
package Leophy.controls {
	import flash.display.Sprite;	

	public class BaseComponent extends Sprite {

		public var version : String = "1.0.0.0";
		protected var _enabled : Boolean = true;
		protected var _width : Number;
		protected var _height : Number;

		public function BaseComponent() {
			super();
			configUI();
		}

		protected function configUI() : void {			
			//isLivePreview = checkLivePreview();
			var w : Number = super.width;
			var h : Number = super.height;
			setSize(w, h);
		}

		public function setSize(width : Number, height : Number) : void {
			_width = width;
			_height = height;
			//dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
		}

		public function setPosition(_x : Number,_y : Number) : void {
			x = Math.round(_x);
			y = Math.round(_y);
			//dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
		}

		override public function get width() : Number { 
			return _width; 
		}

		override public function set width(value : Number) : void {
			if (_width == value) { 
				return; 
			}
			setSize(value, height);
		}

		override public function get height() : Number { 
			return _height; 
		}

		override public function set height(value : Number) : void {
			if (_height == value) { 
				return; 
			}
			setSize(width, value);
		}
	}
}
